package presentation;
import java.awt.Component;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;

public class ProduitListCellRenderer extends DefaultListCellRenderer {

    @Override
    public Component getListCellRendererComponent(
            JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
        super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
        if (value instanceof entity.Produit) {
            entity.Produit c = (entity.Produit) value;
            setText(c.getLibelle());
        }
         if (value instanceof entity.Client) {
            entity.Client c = (entity.Client) value;
            setText(c.getIdentite());
        }
        return this;
    }
}